//弹出层效果
function msgBox(title,content,close,cancel,ok,width){
	if(ok==undefined) ok="确定";
	if(cancel==undefined) cancel="取消";
	if(width==undefined) width=400;
	$.fn.jmodal({
		marginTop: 200,
		initWidth: width,
        title: title,
        content: content,
        buttonText: { ok: ok, cancel: cancel},
        okEvent: function(obj, args) {
            args.complete();
        }
    });
	if(close=='1'){
		window.setTimeout("closeEM()",2000);
	}
}

function closeEM(){
	$('#jmodal-overlay').animate({ opacity: 0 }, function() { $(this).css('display', 'none') });
	$('#jquery-jmodal').animate({ opacity: 0 }, function() { $(this).css('display', 'none') });
}

//获得城市，地区
function getArea(type,father,child,county){
	var fatherid=father.val();
	$.post(
		'ajax.php?action=getArea',
		{type:type,fatherid:fatherid},
		function(data){
			child.show();
			if(county!=''){
				if(data.error=='0' && type=='city'){
					county.html('<option value="">区/县</option>');
				}
				if(data.error!='0'){
					child.hide();
					county.hide();
					county.html('<option value="">区/县</option>');
				}
			}
			child.html(data.child);
		},'json'
	)
}


//输入框闪烁
var Color= ["FEE","FDD","FCC","FBB","FAA","FEE","FDD","FCC","FBB","FAA","FFF"];

function fadeIn(obj,where) {
	if (where >= 0) {
		$(obj).css("background","#" + Color[where]);
		where -= 1;
		setTimeout("fadeIn('"+obj+"',"+where+")", 50);
	} else {
		setTimeout("fadeOut('"+obj+"',0)", 50);
	}
}
function fadeOut(obj,where) {
	if (where <= Color.length) {
		$(obj).css("background","#" + Color[where]);
		where += 1;
		setTimeout("fadeOut('"+obj+"',"+where+")", 50)
	}
}

//简单验证
function queding(msg,inputClass){
	var is_null = true;
	$(inputClass).each(function(i){
		if($(this).val()==""){
			var checkMsg = $(this).attr("checkMsg");
			fadeIn(inputClass+":eq("+i+")",0);
			if(checkMsg!=undefined && checkMsg!=''){
				alert(checkMsg);
			}
			is_null = false;
			return false;
		}
	})
	if(is_null){
		var r = confirm(msg);
		return r;
	}else{
		return false;
	}
}

//简单验证
function quedingSmall(msg,inputClass){
	var is_null = true;
	$(inputClass).each(function(i){
		if($(this).val()==""){
			var checkMsg = $(this).attr("checkMsg");
			fadeIn(inputClass+":eq("+i+")",0);
			if(checkMsg!=undefined && checkMsg!=''){
				alert(checkMsg);
			}
			is_null = false;
			return false;
		}
	})
	if(is_null){
		//var r = confirm(msg);
		return true;
	}else{
		return false;
	}
}


	function getCookie(name) 
	{ 
	    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	 
	    if(arr=document.cookie.match(reg))
	 
	        return unescape(arr[2]); 
	    else 
	        return null; 
	}